package com.sjyp.cms.controller.fornt;

import com.jfinal.core.Controller;
import com.sjyp.cms.model.Article;
import com.sjyp.cms.model.Column;
import com.sjyp.cms.model.Picture;

import java.util.List;

/**
 * 技术 & 培训
 */
public class TrainingController extends Controller {
    public void index() {
        //公司介绍
        String companySql = "select id,name,summary from t_column where id=8";
        Column companySummary = Column.dao.findFirst(companySql);
        this.setAttr("companySummary", companySummary);
        //公司环境
        String companyEnvSql = "select id,name,filePath from t_picture where columnId=9 order by orderNo desc LIMIT 10";
        List<Picture> companyEnvs = Picture.dao.find(companyEnvSql);
        this.setAttr("companyEnvs", companyEnvs);
        //往期学员
        String studentSql = "select id,name,filePath from t_picture where columnId=10 order by orderNo desc LIMIT 9";
        List<Picture> students = Picture.dao.find(studentSql);
        this.setAttr("students", students);
        //培训内容
        String curriculumSql = "select id,title,subtitle,summary,content from t_article where columnId=11 order by orderNo asc LIMIT 3";
        List<Article> curriculums = Article.dao.find(curriculumSql);
        this.setAttr("curriculums", curriculums);
        //师资团队
        String teacherSql = "select id,name,filePath from t_picture where columnId=12 order by orderNo asc limit 12";
        List<Picture> teachers = Picture.dao.find(teacherSql);
        this.setAttr("teachers", teachers);
        this.render("training.html");
    }
}
